﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;

public partial class DemoStoreProcedure_Default2 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        SqlCommand cmd = DataAccess.Connection.CreateCommand();
        cmd.CommandText = "CountProductbyOrigin";
        cmd.CommandType = CommandType.StoredProcedure;
        cmd.Parameters.AddWithValue("@id", TextBox1.Text);
        cmd.Parameters.Add("@total", SqlDbType.Int);
        //dang ky tham so dau ra
        cmd.Parameters["@total"].Direction = ParameterDirection.Output;
        cmd.ExecuteNonQuery();
        //nhan gia tri dau ra
        int total = (int)cmd.Parameters["@total"].Value;
        Response.Write(total);
    }
}
